<template>
  <div class="hello">
    <h1>{{ msg }}</h1>

    <input type="text" placeholder="请输入账号">
    <input type="text" placeholder="请输入密码">

    <button @click="longin" class="longin">登录</button>
    <button @click="test">测试</button>
    <!--<router-link to="/list">跳转到列表页</router-link>  可以用-->
  </div>
</template>

<script>
export default {
  name: 'hello',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  methods: {
    longin: function(){
      let data = {
        name: "xiaopengyou",
        age: "23"
      }
      //this.$store.commit("BAIDU", data);
      this.$store.dispatch('BAIDU', data)

    },
    test: function(){
      console.log(this.$store.state.name);
      this.$store.dispatch('BAIDU', "罗阳")
    }
  }
}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h1, h2 {
  font-weight: normal;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
@color:red;
.longin{
  border:1px solid @color;
}
</style>
